﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OnlineHelpDesk.BLL_Service;

namespace OnlineHelpDesk.Requestor
{
    public partial class RequestorProfile : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Service1 s = new Service1();
                string userName = Session["UserName"].ToString();
                En_Users eu = s.getUserbyName(userName);
                txtUserFullName.Text = eu.UserFullName;
                txtUserAge.Text = eu.UserAge.ToString();
                ddlGender.SelectedValue = eu.UserGender;
                txtUserEmail.Text = eu.UserEmail;
                txtUserName.Text = eu.UserName;
                txtUserType.Text = s.getTypeNamebyTypeIDUser(eu.TypeID);
                
                               
            }
        }

        protected void btnUpdateProfile_Click(object sender, EventArgs e)
        {
            Service1 s = new Service1();
            String UserName = Session["userName"].ToString();
            String UserFullName = txtUserFullName.Text;
            int UserAge = Convert.ToInt32(txtUserAge.Text);
            String UserGenger = ddlGender.SelectedItem.Text.ToString();
            String UserEmail = txtUserEmail.Text;
            s.UpDateProfile(UserName, UserFullName, UserAge, UserGenger, UserEmail);
            Response.Write("<script>alert('Update Profile is Finish!!');</script>");
        }

        protected void btnChangePassword_Click(object sender, EventArgs e)
        {
            Response.Redirect("ChangePassword.aspx");
        }

    }
}